package reflect;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Test {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException {
        Class cls = Class.forName("reflect.Person");
        Object obj = cls.newInstance();

        Method[] method = cls.getMethods();

        for (Method m : method){
            int modifiers = m.getModifiers();
            int cont = m.getParameterCount();
            if (cont == 0 && modifiers == 1){
                m.invoke(obj);
            }
        }
    }
}
